#-*- coding: utf-8 -*-
'''
Created on Aug 24, 2012

@author: bbg
'''

from sqlalchemy import Integer, Column, String, MetaData, Table
from sqlalchemy.orm import mapper

class Company(object):
    '''
    使用这个系统的公司基本信息
    '''

    def __init__(self):
        self.id = 0
        self.name = ''
        self.region_id = 0
        self.address = ''
        self.contact = 0
        self.phone = ''
        self.fax = ''
        self.email = ''
        self.jytype=''
        self.jyguimo=0
        self.yyzz=''
        self.uuid=''
        self.state=0;
        
    @staticmethod
    def doMapping():
        metaData = MetaData()
        companyTable = Table('company', metaData,
                           Column('id', Integer, primary_key = True, autoincrement = True),
                           Column('name', String),
                           Column('region_id', Integer),
                           Column('address', String),
                           Column('contact', String),
                           Column('phone', String),
                           Column('fax', String),
                           Column('email', String), 
                           Column('jytype', String), 
                           Column('jyguimo', Integer), 
                           Column('yyzz', String),       
                           Column('uuid', String),       
                           Column('state', Integer), 
                           schema="company_management")
        
        mapper(Company, companyTable)
        
    
# execute mapping
'''
默认做过mapper，后面使用不需要再进行mapper
'''
Company.doMapping()
        